package com.xdjmall.common;

// 统一响应给客户端的对象
public class ResultInfo<T> {
	// 结果码
	private Integer code;
	// 消息
	private String message;
	// 响应的结果
	private T data;
	
	public static<T> ResultInfo<T> success(T data) {
		ResultInfo<T> ri = new ResultInfo<T>(200, "成功", data);
		return ri;
	}
	
	public static<T> ResultInfo<T> failed(Integer code,String message) {
		ResultInfo<T> ri = new ResultInfo<T>(code, message, null);
		return ri;
	}
	
	public ResultInfo(Integer code, String message, T data) {
		super();
		this.code = code;
		this.message = message;
		this.data = data;
	}
	public ResultInfo() {
		super();
	}
	
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}  
	
}
